package com.richapp.launcher.ui.activities;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import com.jack.util.string.StringUtil;
import com.richapp.launcher.R;
import com.richapp.launcher.database.update.dao.UpdateDao;
import com.richapp.launcher.database.update.mode.Update;

/**
 * Created by jack on 16/1/29.
 */
public class UpdateLogActivity extends Activity {

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);

        //设置无标题
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        //设置全屏显示
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

        setContentView(R.layout.update_log);

        TextView textView = (TextView) findViewById(R.id.textViewUpdateInfo);

        String updateContent = getIntent().getStringExtra("updateContent");
        if(!StringUtil.isNullOrEmpty(updateContent)){
            textView.setText(updateContent);
        }

        UpdateDao updateDao = new UpdateDao(this);
        Update update = updateDao.getLast();
        if(update != null){
            update.setShowFlag(false);
            updateDao.add(update);
        }

        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                finish();
            }
        },30*1000);
    }
}
